package cn.itcast.bos.service.Impl;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.base.IStaffDao;
import cn.itcast.bos.domain.Staff;
import cn.itcast.bos.domain.pagebean.PageBean;
import cn.itcast.bos.service.IStaffService;

@Service
@Transactional
public class IStaffServiceImpl implements IStaffService{
	@Resource
	private IStaffDao staffDao;

	public void saveStaff(Staff model) {
		staffDao.save(model);
	}

	public void pageQueryList(PageBean pageBean) {
		staffDao.pageQueryList(pageBean);
	}

	public void doDelete(String ids) {
		String[] idsarr = ids.split(",");
		for (int i = 0; i < idsarr.length; i++) {
			String id = idsarr[i];
			Staff staff = staffDao.findById(id);
			staff.setDeltag("1");
		}
		
	}

	public Staff findById(String id) {
		return staffDao.findById(id);
	}

	public void update(Staff staff) {
		staffDao.update(staff);
	}

	@Override
	public List<Staff> findByCondition(DetachedCriteria dc) {
		return staffDao.findByCriteria(dc);
	}

	
}
